
// 获取所有可用的住宿信息
exports.getAccommodationList = async (scenic_id, category, page = 1, limit = 10) => {
  // 模拟数据
  const accommodations = [
    { id: 1, scenic_id: 1, accommodation_type: '酒店', name: '周家庄大酒店', price_per_night: 300, description: '四星级酒店，提供优质的住宿服务。', address: '周家庄村中心', contact: '123-456-7890', available_rooms: 10 },
    { id: 2, scenic_id: 1, accommodation_type: '民宿', name: '周家庄温馨民宿', price_per_night: 150, description: '家庭式民宿，适合亲子家庭。', address: '周家庄村东区', contact: '987-654-3210', available_rooms: 5 },
  ];
  return {
    total: accommodations.length,
    page,
    list: accommodations.slice((page - 1) * limit, page * limit),
  };
};

// 获取单个住宿信息的详细内容
exports.getAccommodationById = async (id) => {
  // 模拟数据
  const accommodations = [
    { id: 1, scenic_id: 1, accommodation_type: '酒店', name: '周家庄大酒店', price_per_night: 300, description: '四星级酒店，提供优质的住宿服务。', address: '周家庄村中心', contact: '123-456-7890', available_rooms: 10 },
    { id: 2, scenic_id: 1, accommodation_type: '民宿', name: '周家庄温馨民宿', price_per_night: 150, description: '家庭式民宿，适合亲子家庭。', address: '周家庄村东区', contact: '987-654-3210', available_rooms: 5 },
  ];
  return accommodations.find(accommodation => accommodation.id === parseInt(id));
};

// 创建一个新的住宿信息
exports.createAccommodation = async (accommodationData) => {
  // 模拟数据
  const accommodation = {
    id: Date.now(),
    ...accommodationData,
  };
  return accommodation;
};

// 用户预定住宿
exports.bookAccommodation = async (bookingData) => {
  // 模拟数据
  const booking = {
    reservation_id: Date.now(),
    ...bookingData,
  };
  return booking;
};

// 获取用户预定的住宿记录
exports.getUserReservations = async (user_id) => {
  // 模拟数据
  const reservations = [
    { reservation_id: 1, accommodation_id: 1, accommodation_name: '周家庄大酒店', check_in_date: '2025-02-01', check_out_date: '2025-02-03', price_per_night: 300, total_price: 600 },
  ];
  return reservations.filter(reservation => reservation.user_id === parseInt(user_id));
};

// 取消预订
exports.cancelReservation = async (user_id, reservation_id) => {
  // 模拟数据
  return { user_id, reservation_id, message: '预订取消成功' };
};
